<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<html>
	<head>
		<title>在库-选合格证</title>
		<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<script type="text/javascript">
		function jumpPage(page) {
			var searchForm = document.searchForm;
			var url = "${contextPath}/cs/ct/openChoose.do?currentPage=" + page;
			searchForm.action =url;
			searchForm.submit();
		}
$(function(){
		// 全选/全不选
		$("#check_all").change(function(){
		    
		    var bool = $(this).is(":checked");
		    document.getElementById("ids").value="";
		    $("[name='mid']").each(function(){
		        
		        if(bool){
		            $(this).attr("checked", "checked");
		            
		            cilkeOPneChesis(this);
		        }else{
		            
		            $(this).removeAttr("checked");
		            cilkeOPneChesis(this);
		        }
		        
		        $(this).change();
		    });
		});
		
});
function cilkeOPneChesis(el){
	var ids = document.getElementById("ids").value;
	var id_all = ids.split(",");
	var data_id="";
	
	if(el.checked){
		
		ids += $(el).val()+",";
	}else{
		for(var i=0;i<id_all.length-1;i++){
			if(id_all[i] == $(el).val()){
			}else{
				data_id += id_all[i]+",";
			}
		}
		ids = data_id;
	}
	document.getElementById("ids").value=ids;
}
function buttnOK(){
	var ids = document.getElementById("ids").value;
	window.close();
	window.opener.addChoose(ids);
}

		</script>
	</head>
	<body>
      <form name="searchForm" id="searchForm" method="post" action="${contextPath}/cs/ct/openChoose.do">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
		  <tr>
		    <td height="25" align="left"><font color="#0066CC"><strong>合格证列表：</strong></font></td>
		    <td height="25" align="right" style="padding-right: 40px">
			    <input type="hidden" id="finId" name="finId" value="${finId}"/>
			    <input type="hidden" id="brandId" name="brandId"  value="${brandId }"/>
			    <input type="hidden" id="shopId" name="shopId"  value="${shopId}"/>
			    <input type="hidden" name="theIdLong" id="theIdLong" value='${id}'/>
			    <input type="hidden" id="state" name="state"  value="2"/>
			    <input  type="hidden" id="ids" size="100" maxlength="100"/>
            </td>
		  </tr>
		  <tr>
		    <td height="25" align="left"></td>
		    <td height="25" align="right" style="padding-right: 40px">
			   车架号: <input name="chassis" value="<s:property value='chassis'/> " />
			    <input type="submit" value=""  class="btn_query"/>
            </td>
		  </tr>
		</table>
		</form>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
	  <tr> 
	  	<td width="3%" class="top-td-width-bg"><input type="checkbox" id="check_all" name="check_all" /></td>
	    <td width="5%" class="top-td-width-bg">序号</td>
	    <td width="9%" class="top-td-width-bg">店号</td>
	    <td width="9%" class="top-td-width-bg">店名</td>
	    <td width="9%" class="top-td-width-bg">车型</td>
	    <td width="9%" class="top-td-width-bg">合格证号</td>
	    <td width="9%" class="top-td-width-bg">车架号</td>
	    <td width="9%" class="top-td-width-bg">供货价</td>
	    <td width="9%" class="top-td-width-bg">订单号</td>
	    <td width="9%" class="top-td-width-bg">入库日期</td>
	    <td width="8%" class="top-td-width-bg">状态</td>
	  </tr>
	 <s:iterator value="page.result" status="st" >
		<tr> 
			<td  class="down-center-td-width-bg">
				<input name="mid" type="checkbox" id="<s:property value='id'/>" value="<s:property value='id'/>" onclick="cilkeOPneChesis(this)"/>
			</td>
			<td class="down-center-td-width-bg"><s:property value="#st.index+1"/></td>
		    <td class="down-center-td-width-bg"><s:property value="shop.shopMark"/></td>
		    <td class="down-center-td-width-bg"><s:property value="shop.shopName"/></td>
		    <td class="down-center-td-width-bg"><s:property value="motorcycleType"/></td>
		    <td class="down-center-td-width-bg"><s:property value="certificationNum"/></td>
		    <td class="down-center-td-width-bg"><s:property value="chassis"/></td>
		    <td class="down-center-td-width-bg"><s:property value="formatAmount(supplyPrice)"/><input id="<s:property value='id'/>_supplyPrice" type="hidden" value="<s:property value="supplyPrice"/>"/></td>
		    <td class="down-center-td-width-bg"><s:property value="orderNumber"/></td>
		    <td class="down-center-td-width-bg"><s:date name="warehouseDate" format="yyyy-MM-dd"/></td>
		    <td class="down-center-td-width-bg"><s:property value="state.name" /></td>
		</tr>
	</s:iterator>
	<tr bgcolor="#F9FCEF"> 
	 <td height="36" colspan="12" align="center">
			<%@ include file="/WEB-INF/view/common/pagination.jsp"%>
	 </td>
	</tr>
	<tr> 
	 <td height="26" colspan="12" align="center" bgcolor="#FFFFFF">
			<input id='btn' type="button" value='确定' onclick="buttnOK()" border="0" class="np" style="height: 30px;width: 80px"/>
	 </td>
	</tr>
	</table>
	</body>
</html>